package com.tensquare.friend.dao;

import com.tensquare.friend.pojo.Friend;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by WF on 2019/9/24 10:52
 */
public interface FriendDao extends JpaRepository<Friend,String> {
    //1.根据用户id及好友id查询记录数
    @Query(nativeQuery = true,value="select count(*) from tb_friend where userid=?1 and friendid=?2")
    int selectCount(String userId, String friendid);
    //2.更新islike的值
    @Modifying
    @Query(nativeQuery = true,value="update tb_friend set islike=?1 where userid=?2 and friendid=?3")
    void updateIsLike(String s, String userId, String friendid);
}
